import 'package:flutter/material.dart';
import 'package:flutter_app/widget/AppBarCustom.dart';
import 'package:flutter_app/bean/Shop1.dart';
//import 'package:fluttertoast/fluttertoast.dart';
import 'package:url_launcher/url_launcher.dart';

class ShopDetail extends StatefulWidget {
  Shop1 shop1;
  ShopDetail(this.shop1);

  @override
  State<ShopDetail> createState() => _ShopDetailState();
}

class _ShopDetailState extends State<ShopDetail> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBarCustom(widget.shop1.name),
      body: Column(
        children: <Widget>[
          new Stack(
            children: <Widget>[
              Container(
                color: Color(0xff2c2825),
                height: 100.0,
              ),
              Container(

                height: 120.0,
                padding: EdgeInsets.only(top: 30.0),
                margin: EdgeInsets.only(left: 20.0,right: 20.0),
                child: Row(
                  children: <Widget>[
                    Image.asset(widget.shop1.img,width: 90.0,height: 90.0,fit: BoxFit.cover,),
                    SizedBox(width: 10.0,),
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: <Widget>[

                     Text(widget.shop1.range,style: TextStyle(color: Colors.white),),
                      SizedBox(height: 10.0,),
                      Row(
                        children: <Widget>[
                          Text("${widget.shop1.cust}人已记账",style: TextStyle(color: Color(0xffffffff)),),
                          SizedBox(width: 20.0, ),
                          Text(widget.shop1.dis,style: TextStyle(color: Color(0xffffffff))),
                          SizedBox(width: 20.0,),
                          Text("某地",style: TextStyle(color: Color(0xffffffff))),
                        ],
                        
                      )

                    ],)
                    
                  ],
                  
                ),
              )
            ],
          ),

          Container(
            margin: EdgeInsets.only(top: 10.0,left: 20.0,right: 20.0),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                GestureDetector(
                child:Container(
                  width: 50.0,
                  height: 50.0,
                  padding: EdgeInsets.all(10.0),
                  child:  Image.asset("images/weizhi.png",width: 20.0,height: 20.0,),

                ),
                  onTap: (){
//                  Fluttertoast.showToast(msg: "click");
//                  Navigator.push(context, new MaterialPageRoute(builder: (BuildContext context){
//                    return new MapWidget();
//                  }));
                  },

            )
              ,
               Expanded(child: Text(widget.shop1.xiangxi,overflow: TextOverflow.ellipsis,))
               ,
                GestureDetector(
                  child:Container(
                    width: 50.0,
                    height: 50.0,
                    padding: EdgeInsets.all(10.0),
                    child:  Image.asset("images/phone.png",width: 20.0,height: 20.0,),

                  ),
                  onTap: (){
                      _launchURL();

                  },

                ),

              ],

            ),

          )
        ],
      ),
    );
  }
  _launchURL() async {
    const url = 'tel:+1 555 010 999';
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }
}
